package reportily

import "zy10/global"

func FindId[T any](id uint, data *T) bool {
	err := global.DB.Where("id = ？", id).Find(&data).Limit(1).Error
	if err != nil {
		return false
	}
	return true
}
func GetOneByFields[T any](where *T, data *T) bool {

	if err := global.DB.Where(where).Find(data).Limit(1).Error; err != nil {
		return false
	}
	return true

}

func GetListByFields[T any](where *T, data *[]T) bool {

	if err := global.DB.Where(where).Find(data).Error; err != nil {
		return false
	}
	return true

}
